import express from "express";
import { AuthMiddleware } from "../middleware/auth.middleware";
import { BlogController } from "../controller/blog.controller";
const blogRouter = express.Router();
const blogController = new BlogController();
const authMiddleware = new AuthMiddleware();

blogRouter.get("/blogs", blogController.getAllBlogs);
blogRouter.get("/blog/:id", blogController.getBlog);
blogRouter.post("/blog", blogController.createBlog);

blogRouter.put("/blog/:id", blogController.updateBlog);
blogRouter.delete("/blog/:id", blogController.deleteBlog);
blogRouter.get("/user/:userId/blogs", blogController.getUserBlogs);

blogRouter.use(authMiddleware.authenticate);

export default blogRouter;
